﻿using Microsoft.EntityFrameworkCore;
using Zt.QmtqDemo.Users;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.Modeling;
using Volo.Abp.Users.EntityFrameworkCore;
using Zt.QmtqDemo.ConfmPlan;

namespace Zt.QmtqDemo.EntityFrameworkCore
{
    /* This is your actual DbContext used on runtime.
     * It includes only your entities.
     * It does not include entities of the used modules, because each module has already
     * its own DbContext class. If you want to share some database tables with the used modules,
     * just create a structure like done for AppUser.
     *
     * Don't use this DbContext for database migrations since it does not contain tables of the
     * used modules (as explained above). See QmtqDemoMigrationsDbContext for migrations.
     */
    [ConnectionStringName(QmtqDbProperties.ConnectionStringName)]
    public class QmtqDemoDbContext : AbpDbContext<QmtqDemoDbContext>, IQmtqDbContext
    {
        public DbSet<ConformPlan> ConformPlans { get; set; }
        public DbSet<ConformPlanItem> ConformPlanItems { get; set; }

        public QmtqDemoDbContext(DbContextOptions<QmtqDemoDbContext> options)
            : base(options)
        {

        }

        protected override void OnModelCreating(ModelBuilder builder)
        {
            base.OnModelCreating(builder);

            builder.ConfigureQmtqDemo();
        }
    }
}
